<%@ page contentType="text/html;charset=UTF-8"%>
<%@page import="java.net.InetAddress"%>
<%@page import="com.cnhis.cloudhealth.commons.utils.PropDynamicCfg"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<c:set var="ctx_num" value="${pageContext.request.contextPath}/one" />
<!DOCTYPE HTML>
<html>
<head>
<script src="${ctx}/js.base/jquery-1.11.3.js" ></script>
<link href="${ctx}/lib/bootstrap-3.3.5-dist/css/bootstrap.css" rel="stylesheet">
<script src="${ctx}/lib/bootstrap-3.3.5-dist/js/bootstrap.min.js"></script>

<!-- bootstrap treeview -->
<script src="${ctx}/lib/bootstrap-3.3.5-dist/js/bootstrap-treeview.min.js"></script>

<!-- jqgrid引入 -->
<script src="${ctx}/lib/jq-grid/js/jqgride_width.js"></script>
<script src="${ctx}/lib/jq-grid/js/jquery.jqGrid.js"></script>
<link rel="stylesheet" href="${ctx}/lib/jq-grid/css/ui.jqgrid.css" />
<link rel="stylesheet" href="${ctx}/lib/jq-grid/css/jquery-ui.custom.css" />
<link rel="stylesheet" href="${ctx}/lib/jq-grid/css/jquery-ui-change.css" />
<script type="text/javascript" src="${ctx}/lib/jq-grid/js/grid.locale-cn.js" charset="utf-8"></script>

<!--laytpl  -->
<script src="${ctx}/lib/laytpl/laytpl/laytpl.js"></script>
<script src="${ctx}/lib/laytpl/laytpl/template.js"></script>
<!-- 弹出层 -->
<script type="text/javascript" src="${ctx}/lib/layer/layer.js"></script>
<!-- select2 控件 -->
<link rel="stylesheet" href="${ctx}/lib/select/css/select2.css" />
<script src="${ctx}/lib/select/js/select2.js" type="text/javascript" charset="utf-8"></script>
<script src="${ctx}/lib/select/js/zh-CN.js" type="text/javascript" charset="utf-8"></script>

<!-- icheck -->
<link href="${ctx}/lib/iCheck/skins/square/blue.css" rel="stylesheet" id="ichick_skin">
<script src="${ctx}/lib/iCheck/icheck.js"></script>

<!-- 日期格式化 -->
<script type="text/javascript" src="${ctx}/lib/moment.min.js"></script>

<!-- bootstrap tree view -->
<script src="${ctx}/lib/bootstrap-3.3.5-dist/bootstrap-treeview.js"></script>

<!--根据中文获取拼音首字母  -->
<script src="${ctx}/lib/queryShouzimu.js"></script>


<!-- input 删除组件 -->
<script src="${ctx}/js.base/input_delete.js"></script>
<!--replaceAll函数定义 -->
</head>
<body></body>

<script language="javascript" type="text/javascript">

var bce01 = "<%=request.getSession().getAttribute("employeeId")%>";
var loginName = "<%=request.getSession().getAttribute("loginName")%>";
var userId = "<%=request.getSession().getAttribute("userId")%>";
var userid = "<%=request.getSession().getAttribute("userId")%>";
var jsessionids = "<%=request.getSession().getAttribute("jsessionids")%>";

//门诊医生
var  ipAdress="http://<%=request.getServerName()%>";
var  rootUrl=ipAdress+":<%=request.getServerPort()%><%=request.getContextPath()%>/cloud";
var  myurl=ipAdress+":<%=request.getServerPort()%><%=request.getContextPath()%>/one";
var  hosturl=ipAdress+":<%=request.getServerPort()%><%=request.getContextPath()%>";

//电子病历
var  dzbl = "<%=PropDynamicCfg.get("emrUrl")%>";
//var  dzbl = "http://192.168.3.155:8080/emrweb";
var  dzbl_cloud = dzbl+"/cloud";

//打印预览
var print = "<%=PropDynamicCfg.get("printUrl")%>";
var printUrl = print+"/cloud";//打印预览  
/* var printUrl = "http://192.168.1.107:8081/pmsweb/cloud"; */

//控制中心
var centerRUI1="<%=PropDynamicCfg.get("centerurl")%>";
var centerRUI= centerRUI1+"/cloud";
var  kzzxUrl = centerRUI;
var logoutUrl = centerRUI;


var printUrl1 = print+"/applet/";//直接打印

//会员卡
var memberUrl="<%=PropDynamicCfg.get("memberUrl")%>/cloud";//会员
var memberHostUrl="<%=PropDynamicCfg.get("memberUrl")%>";//会员

//消息推送
var mqUrl="<%=PropDynamicCfg.get("mqUrl")%>";//消息推送
 /*  var mqUrl="http://192.168.3.154:8085/onehismq";//消息推送  */ 

//solr
var solrUrl = "<%=PropDynamicCfg.get("solrUrl")%>";

//读医保卡服务地址
var hoinsurance="<%=PropDynamicCfg.get("hoinsurance")%>";//医保服务

//智慧医保地址
var zhybUrl = "<%=PropDynamicCfg.get("zhybUrl")%>";



//登录判断
/* isLogin();
$(function(){
var loginId=$.cookie('trueName');
var hostWebUrl=myurl+"/pages/login.jsp"
if(loginId==null){
  window.location.href=hostWebUrl;
}
});  */

function replaceAll(str, sptr, sptr1){
    while (str.indexOf(sptr) >= 0){
       str = str.replace(sptr, sptr1);
    }
    return str;
}

/**
 * key :要搜索的文本
 */
function onSearch(key,table_id,searchCol)
{
    //setTimeout(function(){//因为是即时查询，需要用setTimeout进行延迟，让值写入到input内，再读取  
        var storeId = document.getElementById(table_id);//获取table的id标识  
        var rowsLength = storeId.rows.length;//表格总共有多少行  
        var searchCol = 0;//要搜索的哪一列，这里是第一列，从0开始数起  
  
        for(var i=1;i<rowsLength;i++){//按表的行数进行循环，本例第一行是标题，所以i=1，从第二行开始筛选（从0数起）  
            var searchText = storeId.rows[i].cells[searchCol].getElementsByTagName("input")[0].value;//取得table行，列的值  
  			if(storeId.rows[i].className!="innerHead" && searchText!="")
  			{
	            if(searchText.match(key)){//用match函数进行筛选，如果input的值，即变量 key的值为空，返回的是ture，  
	                storeId.rows[i].style.display='block';//显示行操作，  
	            }else{  
	                storeId.rows[i].style.display='none';//隐藏行操作  
	            }  
  			}
        }  
   // },200);//200为延时时间  
}  

//格式化日期
Date.prototype.Format = function(fmt,delayM)   
{ 
  var o = {   
    "M+" : this.getMonth()+1,                 //月份   
    "d+" : this.getDate(),                    //日   
    "h+" : this.getHours(),                   //小时   
    "m+" : this.getMinutes(),                 //分   
    "s+" : this.getSeconds()-(delayM?delayM:0),          //秒   
    "q+" : Math.floor((this.getMonth()+3)/3), //季度   
    "S"  : this.getMilliseconds()             //毫秒   
  };   
  if(/(y+)/.test(fmt))   
    fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));   
  for(var k in o)   
    if(new RegExp("("+ k +")").test(fmt))   
  fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));   
  return fmt;   
} 

//电子病历用方法
function millisecondsStrToDate(str){
    var   startyear   =   1970;
    var   startmonth   =   1;
    var   startday   =   1;
    var   d,   s;
    var   sep   =   ":";
    d   =   new   Date();
    d.setFullYear(startyear,   startmonth,   startday);
    d.setTime(0);
    d.setMilliseconds(str);
    var hour = d.getHours() > 9 ? d.getHours() : "0" + d.getHours();
    var min = d.getMinutes() > 9 ? d.getMinutes() : "0" + d.getMinutes();
    var sec = d.getSeconds() > 9 ? d.getSeconds() : "0" + d.getSeconds();
    s   = d.getFullYear() + "-" + ((d.getMonth()+1) > 9 ? (d.getMonth()+1) : "0" + (d.getMonth()+1)) + "-" + (d.getDate() > 9 ? d.getDate() : "0" + d.getDate()) + " " + hour + ":" + min + ":" + sec + "";
    return s;
}
//数组去重（元素不能包含逗号）
Array.prototype.unique2 = function () {

    return this.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");
    
}

</script>